<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="author" content="wangbo" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>流程语句</title>
</head>

<body>
	<script>

		// 2**4  找到循环体 和循环的次数
		// 3**4  找到循环体 和循环的次数
		// var sum = 2*2*2*2
		// var sum = 3*3*3*3
		var getmi = function () {
			var sum = 1 * 2 * 2 * 2 * 2
			var sum = 1
			sum = 2 * sum
			sum = 2 * sum
			sum = 2 * sum
			sum = 2 * sum
			console.log(sum)
		}
		getmi()
		var getmi = function (n, m) {
			// i 代表循环的次数
			var i = 1
			// sum 代表乘积
			var sum = 1
			while (i <= m) {
				sum = n * sum
				i = i + 1
				console.log(i)
			}
			return sum
		}
		var c = getmi(2, 4)
		console.log(c)

		// var sum = 1+2+3+4+...+100
		// var sum = 0+ 1+2+3+4+...+100 
		//  var sum = 0
		//  sum = 1+sum
		//  sum = 2+sum
		//  sum = 3+sum
		//  sum = 4+sum
		//  ...
		//  sum = 100+sum
		var gethe = function (m) {
			var i = 1
			var sum = 0
			while (i <= m) {
				sum = i + sum
				// console.log(i)
				i = i + 1
			}
			return sum
		}
		var c = gethe(100)
		console.log(c)
	</script>
</body>

</html>